#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include"sqlite/sqlite3.h"
#include"data/user.h"
#include"model/basemodel.h"
#include"contrl/mycontrol.h"
#include<QWidget>
#include"openview.h"

#include<QLabel>
#include<QPushButton>
#include<QImage>
#include<QPixmap>
#include<QHBoxLayout>
#include<QVBoxLayout>
#include<QMessageBox>
#include"ffmpeg/decodevideo.h"
#include"ffmpeg/encodevideo.h"
#include<QFileInfo>
#include"golob.h"
#include<QtMath>
#include"data/device.h"

//#include"view/loginwidget.h"



class MainWidget : public QWidget
{
    Q_OBJECT

public:
    MainWidget(QWidget *parent = 0);
    ~MainWidget();
    void initUI();
    void start();
    bool getIsLogin() const;
    void setIsLogin(bool value);
    void HaveLogin(int x);

    DecodeVideo *getDecode() const;
    void setDecode(DecodeVideo *value);

    EncodeVideo *getEncode() const;
    void setEncode(EncodeVideo *value);

    QPushButton *getLogIn_button() ;
    void setLogIn_button(QPushButton *value);

    int getUser_id() const;
    void setUser_id(int value);



private:
    //sqlite3 *psqlite3;
    User*user;
    BaseModel*model;
    MyControl*con;
    OpenView*w;


    QLabel*title;
    QLabel*screen;

    QPixmap* image;

    QPushButton *takePicture_button;
    QPushButton*playback_button;
    QPushButton*pictrue_button;
    QPushButton*log_button;
    QPushButton*transcode_button;
    QPushButton*set_button;
    QPushButton*logIn_button;


    QHBoxLayout*layout_H1;
    QHBoxLayout*layout_H2;
    QHBoxLayout*layout_H3;
    QHBoxLayout*layout_H4;
    QHBoxLayout*layout_H5;

    QVBoxLayout*layout_V;


    //解码
    DecodeVideo *decode;
    EncodeVideo* encode;

    bool isLogin;

    int totalFrame;

protected:
    void paintEvent(QPaintEvent *event);

    void closeEvent(QCloseEvent *event);
signals:
    void TosetWidget();

    void CloseDecode();
    void CloseEncode();

    void TologinWidget(int sign);

    void ToScenepicture();

//    void takePictrue();

    void ToVideoSelect();

    void ToTransCode();

    void ToLog();
public slots:

    void ClicksetWidget();

    void VideoCording(QImage img);

    void ClicktakePicture_button();
    void Clickplayback_button();
    void Clickpictrue_button();
    void Clicklog_button();
    void Clicktranscode_button();
    void ClicklogIn_button();

    void WriteDateBaseVide();


//    void TimeturnMax();

};

#endif // MAINWIDGET_H
